package com.ostrich.cloud.ostrichUserService.app.jobhander;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ostrich.cloud.ostrichUserService.infra.model.Rider;
import com.ostrich.cloud.ostrichUserService.service.RiderService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class ClearMoney {

    private static Logger logger = LoggerFactory.getLogger(ClearMoney.class);

    @Resource
    private RiderService riderService;

    @XxlJob("clearRiderMoney")
    public void clearRiderMoney(){

        boolean rider_money = riderService.update(new UpdateWrapper<Rider>().set("rider_money", 0.0));
        if (rider_money){
            logger.info("骑手月结已完成");
        }else {
            logger.info("出现异常请检查");
        }

    }
}
